<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="utf-8">
    <meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport">
    <title>用户车辆和设备展示</title>
    <link rel="stylesheet" th:href="@{/frame/vendors/mdi/css/materialdesignicons.min.css}">
    <link rel="stylesheet" th:href="@{/frame/vendors/base/vendor.bundle.base.css}">
    <link rel="stylesheet" th:href="@{/css/style.css}">
    <link rel="stylesheet" th:href="@{/layuiadmin/layui/css/layui.css}">
    <style>
        fieldset {
            border: #000000 solid 1px;
        }

        .layui-tree-txt {
            font-size: 18px;
            margin-left: 5px;
        }

        .layui-tree-entry {
            height: 35px;
        }

        .layui-tree-iconClick {
            height: 15px;
            width: 15px;
        }
    </style>
</head>

<body>
<div class="container-scroller">
    <nav class="navbar col-lg-12 col-12 p-0 fixed-top d-flex flex-row">
        <div class="navbar-brand-wrapper d-flex justify-content-center">
            <div class="navbar-brand-inner-wrapper d-flex justify-content-between align-items-center w-100">
                <a class="navbar-brand brand-logo" th:href="@{/index}">
                    <h1>
                        <span class="display-4" th:text="${session.user.getUserName()}+'欢迎!'"></span>
                    </h1>
                </a>
                <button class="navbar-toggler navbar-toggler align-self-center" data-toggle="minimize" type="button">
                    <span class="mdi mdi-sort-variant"></span>
                </button>
            </div>
        </div>
        <div class="navbar-menu-wrapper d-flex align-items-center justify-content-end">
            <ul class="navbar-nav navbar-nav-right">
                <li class="nav-item nav-profile dropdown">
                    <a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" id="profileDropdown">
                        <img alt="profile" th:src="@{/img/head.jpg}">
                        <span class="nav-profile-name" th:text="${session.user.getUserName()}"></span>
                    </a>
                    <div aria-labelledby="profileDropdown" class="dropdown-menu dropdown-menu-right navbar-dropdown">
                        <a class="dropdown-item" th:href="@{/user/setting}">
                            <i class="mdi mdi-settings text-primary"></i>
                            设置
                        </a>
                        <a class="dropdown-item" th:href="@{/loginout}">
                            <i class="mdi mdi-logout text-primary"></i>
                            登出
                        </a>
                    </div>
                </li>
            </ul>
            <button class="navbar-toggler navbar-toggler-right d-lg-none align-self-center" data-toggle="offcanvas"
                    type="button">
                <span class="mdi mdi-menu"></span>
            </button>
        </div>
    </nav>
    <div class="container-fluid page-body-wrapper">
        <nav class="sidebar sidebar-offcanvas" id="sidebar">
            <ul class="nav">
                <li class="nav-item">
                    <a class="nav-link" th:href="@{/index}">
                        <i class="mdi mdi-home menu-icon"></i>
                        <span class="menu-title">主页</span>
                    </a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" th:href="@{/user/bindcenter}">
                        <i class="mdi mdi-view-headline menu-icon"></i>
                        <span class="menu-title">设备绑定中心</span>
                    </a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" th:href="@{/user/cars}">
                        <i class="mdi mdi-grid-large menu-icon"></i>
                        <span class="menu-title">设备中心</span>
                    </a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" th:href="@{/user/setting}">
                        <i class="mdi mdi-account menu-icon"></i>
                        <span class="menu-title">用户中心</span>
                    </a>
                </li>
            </ul>
        </nav>
        <div class="main-panel">
            <div class="content-wrapper">
                <div class="row">
                    <div class="col-lg-12 grid-margin stretch-card">
                        <div class="card">
                            <div class="card-body">
                                <h4 class="card-title">用户设备状态</h4>
                                <fieldset class="layui-elem-field layui-field-title"
                                          style="margin-top: 30px;margin-left: 5px">
                                    <legend>当前用户绑定设备状态信息展示</legend>
                                    <div class="" id="cars" style="margin-left: 15px"></div>
                                </fieldset>

                            </div>
                        </div>
                    </div>
                </div>
            </div>

        </div>
    </div>
</div>
<!--已经正确-->
<script th:src="@{/frame/vendors/base/vendor.bundle.base.js}"></script>
<script th:src="@{/js/off-canvas.js}"></script>
<script th:src="@{/js/hoverable-collapse.js}"></script>
<script th:src="@{/js/template.js}"></script>

<script th:src="@{/layuiadmin/layui/layui.js}"></script>
<script th>
    layui.config({
        base: '/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(["layer", "tree", "util"], function () {
        var $ = layui.$
            , layer = layui.layer
            , tree = layui.tree
            , util = layui.util;
        //点击节点新窗口跳转
        $.ajax({
            type: 'get',
            url: '/user/iots',
            success: function (data) {
                tree.render({
                    elem: '#cars'
                    , data: data
                    , isJump: true  //link 为参数匹配
                });
                tree.reload("#cars");
            }
        })

    })
</script>
</body>

</html>
